package liming.tool.handle.net.udp2.base;

import liming.tool.handle.net.root.NetReceiveMap;
import liming.tool.handle.net.root.base.Transform;
import liming.tool.handle.net.udp2.socket.UdpReceiveMap;

public interface TransformUdp extends Transform {
    @Override
    default NetReceiveMap transform(NetReceiveMap netReceiveMap) {
        return transformUdp(netReceiveMap);
    }

    default UdpReceiveMap transformUdp(NetReceiveMap netReceiveMap) {
        if (netReceiveMap instanceof UdpReceiveMap) return (UdpReceiveMap) netReceiveMap;
        else return new UdpReceiveMap(netReceiveMap);
    }
}
